#ifndef TCPSESSION_H
#define TCPSESSION_H

#include <QtNetwork>
#include <QObject>
#include <functional>
#include <QThread>

class TcpSession : public QTcpSocket
{
    Q_OBJECT
signals:
    void SignalRead(const QByteArray&);
    void SignalDisconnect(const QString&);
    void SignalDoDisconnect();

public:
    explicit TcpSession();
    ~TcpSession();

    size_t Write(const char* buf, size_t len);    //write binary
    QString getIPPort() const;
    void setIPPort(const QString ip, int port);

    void Disconnect();

private slots:
    void SlotRead();
    void SlotDisconnect();
    void SlotDoDisconnect();

private:
    QString m_IPPort;
};

#endif // TCPSESSION_H
